﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;

using ProjectBase.Core;

namespace ProjectBase.Mvc
{
    /// <summary>html &lt;LABEL&gt; element</summary>
    public class Label : ContentControl<ICoreModel, Label>
    {
        #region members
        Literal _literal = new Literal();
        #endregion members

        #region constructor
        public Label(string text = null, bool doLocalize = true, string cssClassName = null)
            : base(cssClassName)
        {
            Controls.Add(_literal);
            _literal.SetText(text, doLocalize);
        }
        #endregion constructor

        #region Set
        public virtual Label SetText(string text, bool doLocalize = true)
        {
            Literal.Text = text;
            Literal.DoLocalize = doLocalize;
            return this;
        }
        #endregion Set

        #region properties
        public virtual bool HasText
        {
            get { return Literal.Text.IsNotEmpty(); }
        }

        protected override string TagName
        {
            get { return Tag.Label; }
        }

        protected virtual Literal Literal
        {
            get { return _literal; }
            set { _literal = value; }
        }
        #endregion properties
    }
}